home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
OTHER_LA
/
YERK__
/
TOOLBOX_
/
RADIO
< prev
next >
Wrap
Text File
|
1990-11-28
|
2KB
|
63 lines
\ radioSet groups a set of item numbers as a set of radio buttons
\ 7/24/85 cbd Changed on: and off: messages to put:
\ 7/24/85 cbd Added theDialog as an ivar
\ 5/23/90 rfl Class Radio added for general radio buttons. RadioSet is for
\ dialogs
\ rfl RadioSet stores the selected cell for use when dialog is newed
\ 11\28\90 rfl added getItem: in radioset
\ general Radio button class
:CLASS Radio <super ordered-col
int who-is-on
:M GET: get: who-is-on ;M
:M OFF: { ind - } 0 put: [ ind at: self ] ;M
:M ON: { ind - } get: who-is-on off: self 1 put: [ ind at: self ]
ind put: who-is-on ;M
( myctl -- )
:M clickedOn: indexOf: self IF on: self THEN ;M
:M INIT: { ind - } size: self 0 do i off: self loop 1 put: [ ind at: self ]
ind put: who-is-on ;M
( a1 a2... n -- )
:M ACTIONS: dup size: self > classErr" 129
0 do actions: [ size: self 1- i - at: self ] loop
;M
:M hilite: { on/off -- } limit 0 DO on/off hilite: [ i at: self ] LOOP ;M
;CLASS
\ for use in dialogs
:CLASS RadioSet <Super byteCol
Var theDialog
int SelectedCtl
\ ( dialog -- ) associate this radio set with a Dialog
:M INIT: put: theDialog ;M
\ ( item# -- ) select radio button for item#
:M SELECT: { item# -- } size: self 0
DO 0 I at: Self put: [ obj: theDialog ]
LOOP 1 item# put: [ obj: theDialog ] ;M
\ ( -- item# ) return the radio button that was selected
:M GET: { -- item# } size: self 0
DO I at: self get: [ obj: theDialog ]
IF I at: self leave THEN
LOOP ;M
:M SET: get: selectedCtl select: self ;M
:M PUT: ( item# --) put: selectedCtl ;M
:M GETITEM: get: selectedCtl ;M
;CLASS